# User logins\_count per organization

**URL:** <https://community.auth0.com/t/user-logins-count-per-organization/198788>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [April 9, 2026, 7:08am UTC](https://community.auth0.com/t/user-logins-count-per-organization/198788 "2026-04-09T07:08:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Montijn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/montijn/32/78683_2.png) [@Montijn](https://community.auth0.com/u/Montijn)\
**Post date:** [April 9, 2026, 7:08am UTC](https://community.auth0.com/t/user-logins-count-per-organization/198788/1 "2026-04-09T07:08:04Z")

</div>

Hi,  
the Users endpoint of the management-api returns the logins\_count and last\_login of a user. I would like to know if this data is also available per organization a user is in. So for a user I would like the logins\_count on organization a and logins\_count on organization b.

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [April 10, 2026, 5:53pm UTC](https://community.auth0.com/t/user-logins-count-per-organization/198788/3 "2026-04-10T17:53:13Z")

</div>

Hi @Montijn,

Welcome back to the Auth0 Community!

While I totally understand the need of your use case, it is already documented that there **no out-of-the-box solution** to retrieve the logins count per application such as by using a Management API endpoint and there isn’t one either for logins\_count in case of organizations either.

To achieve the desired tracking, the recommended approach is to implement a custom solution using a **Post Login Action**.

Here is a sample action code that you could try, which will insert into the **user’s app metadata** the logins count for each organization and the last login timestamp.

```auto
exports.onExecutePostLogin = async (event, api) => {
  // Only track if the login is contextually within an organization
  if (event.organization) {
    const orgId = event.organization.id;
    const stats = event.user.app_metadata.org_stats || {};

    // Initialize the specific org object if it doesn't exist
    if (!stats[orgId]) {
      stats[orgId] = { logins_count: 0, last_login: null };
    }

    // Increment count and update timestamp
    stats[orgId].logins_count += 1;
    stats[orgId].last_login = new Date().toISOString();

    // Persist to app_metadata
    api.user.setAppMetadata("org_stats", stats);
  }
};

```

I hope this helps and if you have further questions please let me know!  
Best regards,  
Remus

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 24, 2026, 5:53pm UTC](https://community.auth0.com/t/user-logins-count-per-organization/198788/4 "2026-04-24T17:53:30Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
