> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Graph (Microsoft 365)

> Microsoft 365 / Entra ID tenant data through Microsoft Graph: users, groups and members, licence subscriptions and assignments, Microsoft 365 activity reports and sign-in logs.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/microsoft-graph.webp?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=9d73b3bc9fe17a5a8bf79cdfcd24717b)

[Web Catalog · Productivity](https://docs.webrouter.net/data-apis.md?category=productivity)

Needs&#x20;

`MS_GRAPH_CLIENT_ID`

,&#x20;

`MS_GRAPH_CLIENT_SECRET`

,&#x20;

`MS_GRAPH_REFRESH_TOKEN`

Endpoints

8

Auth

OAuth refresh token

[Vendor docs](https://learn.microsoft.com/en-us/graph/overview)

## Setup

| Variable | | What it is |
| - | - | - |
| `MS_GRAPH_CLIENT_ID` | required | Application (client) id of an Entra ID app registration. |
| `MS_GRAPH_CLIENT_SECRET` | required | A client secret of that app registration (web/confidential client). |
| `MS_GRAPH_REFRESH_TOKEN` | required | A refresh token from the authorization code flow, requested with offline\_access and the Graph permissions the calls need (User.Read.All, GroupMember.Read.All, LicenseAssignment.Read.All, Reports.Read.All, AuditLog.Read.All). |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* Calls act as the signed-in user behind the refresh token (delegated permissions): besides the app's consented Graph permissions, that user needs an Entra role that can read the data (e.g. Global Reader or Reports Reader for reports and sign-ins).
* Lists page with @odata.nextLink: call that full URL for the next page; \$skip is not supported on directory objects.
* Advanced queries (\$search, \$count, most \$filter/\$orderby on users, groups and members) need the ConsistencyLevel: eventual header and \$count=true.
* Usage reports answer 302 to a short-lived pre-signed CSV download, not JSON.
* Throttled requests get 429 with a Retry-After header.

## Endpoints

GET

List users

Users in the tenant with name, mail, job title and any \$select-ed properties.

[Open](#microsoft-graph-users-list)

GET

Get a user

One user's profile by object id or userPrincipalName.

[Open](#microsoft-graph-users-get)

GET

List a user's licences

Licence SKUs and service plans assigned to a user, directly or through groups.

[Open](#microsoft-graph-users-licenses)

GET

List groups

Groups in the tenant (Microsoft 365, security, distribution).

[Open](#microsoft-graph-groups-list)

GET

List group members

Direct members of a group (users, devices, contacts, groups).

[Open](#microsoft-graph-groups-members)

GET

List licence subscriptions

The tenant's commercial subscriptions with enabled, consumed and suspended units per SKU.

[Open](#microsoft-graph-subscribed-skus-list)

GET

Get Microsoft 365 active user detail

Per-user licence flags and last activity dates for Exchange, OneDrive, SharePoint, Teams and Yammer, as CSV.

[Open](#microsoft-graph-reports-active-users)

GET

List sign-ins

Entra ID sign-in events, newest first, with user, app, IP, location, device and status.

[Open](#microsoft-graph-signins-list)

### List users

GET

`/users`

`microsoft-graph.users.list`

Users in the tenant with name, mail, job title and any \$select-ed properties.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>

    <tr>
      <td>
        `filter`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData filter, e.g. startswith(displayName,'a') or accountEnabled eq true.
      </td>
    </tr>

    <tr>
      <td>
        `search`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Quoted property:text search, e.g. "displayName:anna". Needs ConsistencyLevel: eventual and \$count=true.
      </td>
    </tr>

    <tr>
      <td>
        `orderby`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData order, e.g. displayName.
      </td>
    </tr>

    <tr>
      <td>
        `top`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Page size, default 100, max 999.
      </td>
    </tr>

    <tr>
      <td>
        `count`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        true to include @odata.count; needed with \$search and advanced filters.
      </td>
    </tr>

    <tr><td>`consistency_level`</td><td>string</td><td>header</td><td>eventual; required with \$search, \$count and advanced \$filter/\$orderby queries. One of `eventual`</td></tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0)

```python Python theme={null}
router.call_data_api("microsoft-graph.users.list")
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.users.list")
```

### Get a user

GET

`/users/{user}`

`microsoft-graph.users.get`

One user's profile by object id or userPrincipalName.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`user` required</td><td>string</td><td>path</td><td>Object id or userPrincipalName. Example `adelev@contoso.com`</td></tr>

    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0)

```python Python theme={null}
router.call_data_api("microsoft-graph.users.get", {'user': 'adelev@contoso.com'})
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.users.get", params={"user": "adelev@contoso.com"})
```

### List a user's licences

GET

`/users/{user}/licenseDetails`

`microsoft-graph.users.licenses`

Licence SKUs and service plans assigned to a user, directly or through groups.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `user`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Object id or userPrincipalName.
      </td>
    </tr>

    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/user-list-licensedetails?view=graph-rest-1.0)

### List groups

GET

`/groups`

`microsoft-graph.groups.list`

Groups in the tenant (Microsoft 365, security, distribution).

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>

    <tr>
      <td>
        `filter`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData filter, e.g. startswith(displayName,'a') or accountEnabled eq true.
      </td>
    </tr>

    <tr>
      <td>
        `search`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Quoted property:text search, e.g. "displayName:anna". Needs ConsistencyLevel: eventual and \$count=true.
      </td>
    </tr>

    <tr>
      <td>
        `orderby`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData order, e.g. displayName.
      </td>
    </tr>

    <tr>
      <td>
        `top`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Page size.
      </td>
    </tr>

    <tr>
      <td>
        `count`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        true to include @odata.count; needed with \$search and advanced filters.
      </td>
    </tr>

    <tr><td>`consistency_level`</td><td>string</td><td>header</td><td>eventual; required with \$search, \$count and advanced \$filter/\$orderby queries. One of `eventual`</td></tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0)

```python Python theme={null}
router.call_data_api("microsoft-graph.groups.list")
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.groups.list")
```

### List group members

GET

`/groups/{group_id}/members`

`microsoft-graph.groups.members`

Direct members of a group (users, devices, contacts, groups).

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `group_id`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Group object id.
      </td>
    </tr>

    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>

    <tr>
      <td>
        `filter`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData filter, e.g. startswith(displayName,'a') or accountEnabled eq true.
      </td>
    </tr>

    <tr>
      <td>
        `search`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Quoted property:text search, e.g. "displayName:anna". Needs ConsistencyLevel: eventual and \$count=true.
      </td>
    </tr>

    <tr>
      <td>
        `top`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Page size, default 100, max 999.
      </td>
    </tr>

    <tr>
      <td>
        `count`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        true to include @odata.count; needed with \$search and advanced filters.
      </td>
    </tr>

    <tr><td>`consistency_level`</td><td>string</td><td>header</td><td>eventual; required with \$search, \$count and advanced \$filter/\$orderby queries. One of `eventual`</td></tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0)

> [!NOTE]
>
> * Not transitive: nested groups' members are not expanded.

### List licence subscriptions

GET

`/subscribedSkus`

`microsoft-graph.subscribed_skus.list`

The tenant's commercial subscriptions with enabled, consumed and suspended units per SKU.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `select`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated properties to return; defaults to a small set.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/subscribedsku-list?view=graph-rest-1.0)

```python Python theme={null}
router.call_data_api("microsoft-graph.subscribed_skus.list")
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.subscribed_skus.list")
```

### Get Microsoft 365 active user detail

GET

`/reports/getOffice365ActiveUserDetail(period='{period}')`

`microsoft-graph.reports.active_users`

Per-user licence flags and last activity dates for Exchange, OneDrive, SharePoint, Teams and Yammer, as CSV.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`period` required</td><td>string</td><td>path</td><td>Days aggregated. One of `D7`, `D30`, `D90`, `D180` Example `D7`</td></tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/reportroot-getoffice365activeuserdetail?view=graph-rest-1.0) · Same job: [Amplitude](https://docs.webrouter.net/data-apis/amplitude.md#amplitude-charts-query), [Close](https://docs.webrouter.net/data-apis/close-crm.md#close-crm-reports-activity), [Cloudflare](https://docs.webrouter.net/data-apis/cloudflare.md#cloudflare-analytics-graphql), [Google Analytics 4 (Data API)](https://docs.webrouter.net/data-apis/google-analytics.md#google-analytics-report-run), [Instagram Graph API](https://docs.webrouter.net/data-apis/instagram.md#instagram-user-insights), [Klaviyo](https://docs.webrouter.net/data-apis/klaviyo.md#klaviyo-campaigns-report)

```python Python theme={null}
router.call_data_api("microsoft-graph.reports.active_users", {'period': 'D7'})
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.reports.active_users", params={"period": "D7"})
```

> [!NOTE]
>
> * Answers 302 to a pre-signed CSV URL valid for a few minutes. Needs Reports.Read.All.

### List sign-ins

GET

`/auditLogs/signIns`

`microsoft-graph.signins.list`

Entra ID sign-in events, newest first, with user, app, IP, location, device and status.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `filter`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        OData filter; give a time range to avoid timeouts, e.g. createdDateTime ge 2024-07-01T00:00:00Z.
      </td>
    </tr>

    <tr>
      <td>
        `top`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Page size, default and max 1000.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://learn.microsoft.com/en-us/graph/api/signin-list?view=graph-rest-1.0) · Same job: [Datadog](https://docs.webrouter.net/data-apis/datadog.md#datadog-logs-search), [Resend](https://docs.webrouter.net/data-apis/resend.md#resend-logs-list), [Sentry](https://docs.webrouter.net/data-apis/sentry.md#sentry-explore-events), [Supabase](https://docs.webrouter.net/data-apis/supabase.md#supabase-logs-query), [Vercel](https://docs.webrouter.net/data-apis/vercel.md#vercel-deployments-events)

```python Python theme={null}
router.call_data_api("microsoft-graph.signins.list")
```

```text MCP theme={null}
call_data_api(endpoint="microsoft-graph.signins.list")
```

> [!NOTE]
>
> * Only events within Entra ID's retention period are available. Needs AuditLog.Read.All.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.